<template>
	<view class="coupon">
		<view class="cover">
			<image :src="info.icon" mode="aspectFit"></image>
		</view>
		<view class="intro">
			<view>
				<view class="title">{{info.coupon_name}}</view>
				<view class="limit" v-if="info.coupon_tag.length > 0">{{info.coupon_tag[0]}}</view>
				<view class="time">获取后{{info.coupon_validity}}天有效</view>
			</view>
			<view class="btn" @click="handler('clickBtn')" v-if="info.is_receive === 0">立即领取</view>
			<view class="btn disabled" v-else>已领取</view>
			<view class="num">x{{info.coupon_num}}张</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		props: {
			info: {
				type: Object,
				default: () => {}
			},
			// 是否失效
			invalid: {
				type: Boolean,
				default: false
			}
		},
		methods: {
			handler(event) {
				this.$emit(event, this.info)
			}
		}
	}
</script>

<style scoped lang="scss">
	$passedColor: #666;
	.coupon-group:last-child{
		margin-bottom: 0;
	}
	.coupon {
		border-radius: 15rpx;
		@extend .flex-btw;
		height: 170rpx;
		margin-bottom: 30rpx;
		background-color: #F8F9FA;
		padding: 20rpx;
		height: 203rpx;
		box-sizing: border-box;
		.cover{
			width: 163rpx;
			height: 163rpx;
			margin-right: 22rpx;
			image{
				width: 100%;
				height: 100%;
			}
		}
		.intro {
			@extend .flex-btw;
			flex: 1;
			box-sizing: border-box;
			height: 100%;
			position: relative;

			.title {
				font-size: 28rpx;
				font-weight: bold;
			}

			.limit {
				font-size: 20rpx;
				border: 1px solid #FF3B30;
				color: #FF3B30;
				display: inline-block;
				padding: 0 5rpx;
			}

			.time {
				margin-top: 30rpx;
				font-size: 20rpx;
				color: #666666;
			}
			.num{
				white-space: nowrap;
				position: absolute;
				right: 0;
				bottom: 0;
				color: #7A2600;
				font-size: 26rpx;
				font-style: oblique;
			}
		}

		.btn {
			padding: 14rpx 18rpx;
			background-color: #FF9500;
			border-radius: 60rpx;
			color: #FFF;
			font-size: 26rpx;
			white-space: nowrap;
			margin-bottom: 20rpx;
			&.disabled{
				background-color: #999999;
			}
		}
	}
</style>
